package cn.ycbjie.ycaudioplayer.newpack.linkagescroll.contentmode.wight;

import android.app.Activity;
import android.graphics.Bitmap;
import android.net.http.SslError;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
import android.webkit.WebViewClient;

/**
 * Created by yuyu on 2018-11-06.
 */

public class MyWebViewClient extends WebViewClient {
    //    private WaitingDialog dialog;
    private Activity activity;

    public MyWebViewClient() {
//        dialog = new WaitingDialog(activity);
//        this.activity = activity;
    }

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        // LogUtil.e(url);
        view.loadUrl(url);
        return true;
    }

    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
        super.onPageStarted(view, url, favicon);
//        if(!activity.isFinishing()) dialog.show();
    }

    @Override
    public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
        handler.proceed();
        super.onReceivedSslError(view, handler, error);
    }

    @Override
    public void onPageFinished(WebView view, String url) {
        super.onPageFinished(view, url);
//        if(!activity.isFinishing()) dialog.dismiss();
    }
}